package com.ihd.ihardware.view.tzc.me.view;

import android.os.Bundle;

import com.ihd.ihardware.R;
import com.ihd.ihardware.common.AppConstans;
import com.ihd.ihardware.databinding.ActivityCollectBinding;
import com.ihd.ihardware.pojo.CollectRes;
import com.ihd.ihardware.view.tzc.me.viewmodel.CollectViewModel;

import cn.wowjoy.commonlibrary.base.BaseActivity;
import cn.wowjoy.commonlibrary.base.BaseConsumer;

public class CollectActivity extends BaseActivity<ActivityCollectBinding, CollectViewModel> {

    @Override
    protected void init(Bundle savedInstanceState) {
        mImmersionBar.statusBarDarkFont(true).init();
        binding.mtitlebar.setTitle("我的收藏");
        binding.mtitlebar.setLeftBack(this);

        setRx(AppConstans.COLLECTART, new BaseConsumer<CollectRes>() {
            @Override
            protected void onStart() {
            }

            @Override
            protected void onSuccess(CollectRes mLiveData) {
                viewModel.setCollectList(mLiveData.getData().getList());
            }

            @Override
            protected void onError(Throwable error) {
            }
        });

        binding.collectRV.setAdapter(viewModel.mConcernedAdapter);
        viewModel.getCollectList();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_collect;
    }

    @Override
    protected Class getViewModelClass() {
        return CollectViewModel.class;
    }

}
